# -*- coding: utf-8 -*-
"""
@Time ： 2025/5/24 11:29
@Auth ： 九问
@File ：debug_talk.py
@IDE ：PyCharm
@Email : 2750826557@qq.com
"""
import base64
import hashlib
import time

import yaml


class DebugTalk:

    @staticmethod
    def read_yaml_key(key):
        with open("../extract.yaml", encoding="utf-8") as f:
            value = yaml.safe_load(f)
            return value[key]

    @staticmethod
    def add(a, b):
        return int(a) + int(b)

    @staticmethod
    def md5(data):
        data = str(data).encode('utf-8')
        return hashlib.md5(data).hexdigest()

    @staticmethod
    def base64_encode(data):
        data = str(data).encode('utf-8')
        return base64.b64encode(data).decode(encoding='utf-8')

    @staticmethod
    def get_random_num():
        return str(int(time.time()))


if __name__ == '__main__':
    print(DebugTalk.md5(123))
    print(DebugTalk.base64_encode(123))
